/**
 * @author yuyangyang
 * @time 2015/3/16
 */
var _ = require('underscore');
var logger = require('../utils/logger').getLogger('default');
var meetService = require('../services/meet');
var categoryService = require('../services/sport');
var joinService = require('../services/join');

module.exports = {
    mapping: '/join',
    get: {
        '/message': function (req, res) {
            joinService.queryItem(_.extend({
                joiner: req.session.userId
            }, req.query), function (err, data) {
                res.json(data);
            });
        }
    },
    post: {
        '/new': function (req, res) {
            joinService.addJoin(_.extend({joiner: req.session.userId}, req.body), function (err, data) {
                res.json(data);
            });
        },
        '/cancel': function (req, res) {
            joinService.delete({_id: req.body.joinId}, function (err, data) {
                res.json(data);
            });
        }
    }
}